package com.paireach.szwolaiyun.mode;

import android.util.Log;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;

/**
 * 货物详情
 * Created by Administrator on 2016/6/23.
 */
public class GoodsMode {

    private ArrayList<ProductMode>list=new ArrayList<ProductMode>();//产品list

    public ArrayList<ProductMode> getList() {
        return list;
    }

    public void setList(ArrayList<ProductMode> list) {
        this.list = list;
    }

    public void initData(String jsonString){
        Log.e("0011","初始化运单详情信息"+jsonString);
        try {
            JSONObject object=new JSONObject(jsonString);
            if(object.optBoolean("resultFlag")&&!object.optString("responseEntity").equals("null")){
                JSONArray jsonArray=new JSONArray(object.optString("responseEntity"));
                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject productObj=jsonArray.getJSONObject(i);
                    ProductMode productMode=new ProductMode();
                    productMode.init(productObj);
                    list.add(productMode);
                }


            }


        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
